package com.bdqn.boot.yuanshen.service.impl;

import com.bdqn.boot.yuanshen.bean.Interactions;
import com.bdqn.boot.yuanshen.mapper.InteractionsMapper;
import com.bdqn.boot.yuanshen.service.InteractionsService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @Author 周宏锦
 * @Description TODO
 * @Date 2025/3/21 9:33
 * @Version 1.0
 */
@Service
public class InteractionsServiceImpl implements InteractionsService {
    @Autowired
    private InteractionsMapper interactionsMapper;
    /**
     * 添加互动数据
     *
     * @param interactions 互动表实体类
     * @return 返回受影响的行数
     */
    @Override
    public int addInteractions(Interactions interactions) {
        return interactionsMapper.addInteractions(interactions);
    }

    /**
     * 修改互动数据
     *
     * @param interactions 互动表实体类
     * @return 返回受影响的行数
     */
    @Override
    public int updateInteractions(Interactions interactions) {
        return interactionsMapper.updateInteractions(interactions);
    }

    /**
     * 删除互动数据
     *
     * @param id 删除编号
     * @return 返回受影响的行数
     */
    @Override
    public int delInteractions(Integer id) {
        return interactionsMapper.delInteractions(id);
    }

    /**
     * 多条件查询互动集合列表
     *
     * @param map      多条件集合列表
     * @param pageNum 页码
     * @param pageSize 页面条数
     * @return 返回互动集合列表
     */
    @Override
    public PageInfo<Interactions> getInteractionsList(Map<String, Interactions> map, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Interactions> list = interactionsMapper.getInteractionsList(map);
        return new PageInfo<>(list);
    }
}
